<!DOCTYPE html>
<html>
<head>
  <title>新闻管理系统</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.1.0/css/bootstrap.min.css">
  <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://cdn.staticfile.org/popper.js/1.12.5/umd/popper.min.js"></script>
  <script src="https://cdn.staticfile.org/twitter-bootstrap/4.1.0/js/bootstrap.min.js"></script>
  <script type="text/javascript" src="{{asset('js/vue.js')}}"></script>
</head>
<body>

  <!-- banner -->
  <div class=" text-center" style="background-color:#83b0d8 ;padding: 20px 0;">
    <h1>新闻管理系统</h1>
    <p>Jenny xu</p> 
  </div>



  <div class="container col-sm-12">
<div class="row ">

    <div class="col-sm-2 "style="background-color:#b4d7f6;height: 550px;">
     <ul style="list-style-type:none;margin-top:50px;">
       <li><h3><a href="/indexsystem">新闻管理</a></h3></li>
       <li><h3><a href="indexsystemlist">栏目管理</a></h3></li>
     </ul>
   </div>


   <div class=" col-sm-10 " style="background-color: ; height: 24px;">

<div class="card-body" > 

<div class="input-group col-sm-5 " style="padding-bottom: 30px;">
    <button type="button" data-toggle="modal" data-target="#addnews" class="input-group-text" style="margin-left: 30px;">添加栏目</button> 
  </div>
<div  style="height: 450px;overflow:auto;">
          <table>
            <tbody >
             @foreach ($list as $list)
              <tr style="border-bottom: 1px black solid "> 
              <td>{{$loop->index+1}}、</td> 
                <td> {{ $list->classname }}</td> <td  style="padding-left: 50px;"><a type="button" data-toggle="modal" 
                  data-target="#modifynews" id="mo" 
                  value ="{{$list->id}}" onclick="modify()">修改</a></td><td style="padding-left: 10px;"><a href="{{url('/deletelist/indexsystemlist/')}}/{{$list->id}}" onclick="isdelete()" >删除</a></td>  
              </tr> 
              @endforeach
            </tbody>
          </table>
          </div>
        </div>
   </div>
</div>
 </div>


</body>
</html>

<!--添加新闻模态框 -->
<div class="modal fade" id="addnews">
  <div class="modal-dialog">
    <div class="modal-content">
      <!-- 模态框头部 -->
      <div class="modal-header">
        <h4 class="modal-title" >添加栏目</h4>
        <button type="button" class="close" data-dismiss="modal">&times;</button>
      </div>
      <!-- 模态框主体 -->
      <div class="modal-body">
        <form method="POST" action="addlist/indexsystemlist">
            @csrf
          <div class="input-group mb-3 input-group-sm">
           <div class="input-group-prepend">
             <span class="input-group-text">栏目名字</span>
           </div>
           <input type="text"name="title" class="form-control" id='title'>
         </div>
        <div class="modal-footer"><button type="submit" class="btn btn-secondary" >提交</button> </div>
      </form>
      <!-- 模态框底部 -->
            <!-- disabled="disabled" <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button> -->
    </div>
  </div>
</div>
</div>
<!--修改新闻模态框 -->
<div class="modal fade" id="modifynews">
  <div class="modal-dialog">
    <div class="modal-content">
      <!-- 模态框头部 -->
      <div class="modal-header">
        <h4 class="modal-title" >修改新闻</h4>
        <button type="button" class="close" data-dismiss="modal">&times;</button>
      </div>
      <!-- 模态框主体 -->
      <div class="modal-body">
        <form method="POST" action="modifylist/indexsystemlist">
            @csrf
          <div class="input-group mb-3 input-group-sm">
           <div class="input-group-prepend">
             <span class="input-group-text">标题  </span>
           </div>
           <input type="text"name="title" class="form-control" id='title'>
              <input  name="id" id="mid" style="display: none;" />
         </div>
         
        <div class="modal-footer"><button type="submit" class="btn btn-secondary" >提交</button> </div>
      </form>
      <!-- 模态框底部 -->
            <!-- disabled="disabled" <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button> -->
    </div>
  </div>
</div>
</div>
<script>
    function modify(){
var id= $("#mo").attr("value");
    /* $("#mid").val(id);*/
     console.log(id);
   }
   function isdelete(){
    alert("是否删除此条栏目？");
   }

</script>
